package com.stars.empoly.vmodel

import android.app.Application
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.stars.empoly.activity.ApplyActivity
import com.stars.empoly.model.UseOrderDetail
import com.stars.empoly.utils.net.NetEngine
import com.trailer.base.base.BRepository
import com.trailer.base.base.BViewModel
import com.trailer.base.utils.UiSwitch
import kotlinx.coroutines.launch

class OrderDetailsVModel(application: Application) : BViewModel<BRepository>(application) {

    var id:String?=null

    var bean= MutableLiveData<UseOrderDetail>()

    fun setTips(technicianStatus:Int?,serviceTime:String?):String{

        when(technicianStatus){

            1->{
                return "订单进行中($serviceTime)"
            }
            2->{
                return "订单进行中($serviceTime)"
            }
            3->{
                return "订单进行中($serviceTime)"
            }

        }

        return "订单进行中($serviceTime)"
    }



    fun getInfo(){
        viewModelScope.launch{
            var it=repository().lreq { NetEngine.service.OrderDetail(id) }
            if(it.ok()){
                bean.value=it.data
            }

        }
    }

}
